import React from "react";
import 'styles/icon.scss'
import 'static/iconfont'

class SVGIcon extends React.Component {
  render() {
    const { style, type, className } = this.props;
    return (
      <i style={style}>
        <svg className={`icon ${className ? className : ''}`} aria-hidden="true">
          <use xlinkHref={`#icon-${type}`} />
        </svg>
      </i>
    );
  }
}

SVGIcon.propTypes = {
  className: React.PropTypes.string,
  type: React.PropTypes.string.isRequired,
  style: React.PropTypes.object
};

SVGIcon.defaultProps = {
  style: {}
};

export default SVGIcon;
